package com.sc.design.PK.structure.proxy_decoration.proxy;

import java.util.Random;

/**
 * @author sc
 * Created on  2017/12/8
 */
public class RunnerAgent implements IRunner {

    private IRunner runner;

    RunnerAgent(IRunner runner){
        this.runner= runner;
    }

    @Override
    public void run() {
        Random random = new Random();
        if(random.nextBoolean()){
            System.out.println("代理人让他去跑");
            runner.run();
        }else{
            System.out.println("不让他跑");
        }
    }
}
